import java.util.Scanner;

public class Decimal {
    public static void main(String[] args) {
        //1.输入一个实数
        Scanner input = new Scanner(System.in);
        System.out.print("请输入一个小数：");
        double number = input.nextDouble();

        //2.实数转换为字符串
        String numStr = number + "";
        //3.以小数点为分界，求出整数、小数部分
        int pointIndex = numStr.indexOf('.');
        //整数部分
        String headPart = numStr.substring(0,pointIndex);
        int headLen = headPart.length();
        //小数部分
        String tailPart = numStr.substring(pointIndex + 1);
        int tailLen = tailPart.length();

        //输出
        System.out.println("用户输入的小数是：" + number);
        System.out.println("整数部分是：" + headPart);
        System.out.println("整数位数有：" + headLen + "位");

        System.out.println("小数部分是：" + tailPart);
        System.out.println("小数位数有：" + tailLen + "位");

    }
}
